<?php

include("../te.php");

class ImageFrame extends TE{

	public $size="64";
	
	public function show(){
		$img = $this->replace($this->block);
		//$this->parse("{Shadow {$this->oid}_shadow|}<div id='{oid}' name='{oid}' style='border: 1px solid #848284;width:{size};'>{$img}</div>{|{$this->oid}_shadow}");
		$this->parse("<div id='{oid}' name='{oid}' style='border: 1px solid #848284;width:{size};'>{$img}</div>");
		return $this->replace();
	}

}


class Button extends TE{
	public $text="&#9679;";
	public $type="button";
	
	function show(){
		if(isset($this->block)){
			$this->text = $this->replace($this->block);
		}
		$this->parse(file_get_contents("button.tpl.html"));
		return $this->replace();
	}

}
class TextBox extends TE{

	public $text="";
	public $size=12;
	

	function show(){
		$this->text = $this->replace($this->block);
		$this->text = trim($this->text);
		$this->parse(file_get_contents("textbox.tpl.html"));
		return $this->replace();
	}
}

class Logo extends TE{

	public $size=10;
	public $src="";

	public function show(){
		
		$this->block=("<img src='{$this->src}' width='{$this->size}' title='{$this->block}'>");			
		
		return $this->replace();
	}
}

class Header extends TE{

	public function show(){
		
	    
		$this->parse(file_get_contents("header.tpl.html"));
		
		return $this->replace();
	}

}

class Footer extends TE{

	public function show(){
		$this->parse(file_get_contents("footer.tpl.html"));		
		return $this->replace();
	}

}



class Layout extends TE{

	public $header;
	public $body;
	public $footer;

	public function show(){
		
		$this->parse($this->block);
		$this->body=$this->replace($this->block);
		
		$this->parse(file_get_contents("layout.tpl.html"));			
		
		
		$this->topLayer->header    = new Header();
		$this->bottomLayer->footer = new Footer();	
		
		return $this->replace();
	}

}

class Shadow extends TE{
	
	public $opacity=1; //values between 0.1 .. 1
	
	public function show(){
	
		$this->parse($this->block);
		$this->text=$this->replace();
		$this->parse(file_get_contents("shadow.tpl.html"));
		$this->alfaOpacity=100*$this->opacity;	
		return $this->replace();
	}
}


class Layer extends TE{
	//position
	public $position="relative";
	public $t="none"; //top
	public $b="none"; //bottom
	public $l="none"; //left
	public $r="none"; //right
	//margin
	public $m="none"; //margin
	public $p="none"; //padding
	
	public function show(){
	
		$this->parse($this->block);
		$this->text=$this->replace();
		$this->parse(file_get_contents("layer.tpl.html"));
		
		return $this->replace();
	}
}

class FixedLayer extends Layer{

	
	public function show(){
	
		$this->parse($this->block);
		$this->text=$this->replace();
		$this->parse(file_get_contents("fixedlayer.tpl.html"));
		
		return $this->replace();
	}
	
}

class Page extends TE{

	public $title="Pagina de prueba 2";
	public $header;
	public $footer;
	
	function show(){
	
		$this->hola="Holaaaaaaa!!! ";
			
		return $this->replace();
	}

	
	
}



$page = new Page();

$page->parse(file_get_contents("page.tpl.html"));
echo $page->show();
echo "<pre>";
#print_r($page);
echo $page->dump();



?>